package com.cloud.jucTest;
//可重入锁 父子类可重入
public class ReentrantsLockTest {

    static class ParentLock {
        byte[] lock = new byte[0];
        public void f1 () {
            synchronized (lock) {
                System.out.println("f1 from parent");

            }
        }
    }

    static class SonLock extends ParentLock {
        public void f1() {
            synchronized (super.lock) {
                super.f1();
                System.out.println("f1 from son");
            }
        }
    }

    public static void main(String[] args) {
        ParentLock parentLock = new SonLock();
        parentLock.f1();
    }
}
